/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package verins.beans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author hectdx
 */
@Entity
@Table(name = "paginapadronelectoral", schema = "verinscribe")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Paginapadronelectoral.findAll", query = "SELECT p FROM Paginapadronelectoral p order by p.paginapadronelectoralPK.numeropagina"),
    @NamedQuery(name = "Paginapadronelectoral.findByNumeropagina", query = "SELECT p FROM Paginapadronelectoral p WHERE p.paginapadronelectoralPK.numeropagina = :numeropagina"),
    @NamedQuery(name = "Paginapadronelectoral.findByIdpadronelectoral", query = "SELECT p FROM Paginapadronelectoral p WHERE p.paginapadronelectoralPK.idpadronelectoral = :idpadronelectoral"),
    @NamedQuery(name = "Paginapadronelectoral.findByEstado", query = "SELECT p FROM Paginapadronelectoral p WHERE p.estado = :estado")})
public class Paginapadronelectoral implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PaginapadronelectoralPK paginapadronelectoralPK;
    @Column(name = "estado", length = 50)
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "paginapadronelectoral")
    private List<Padronelectorallinea> padronelectorallineaList;
    @JoinColumn(name = "iddigitador", referencedColumnName = "dni", nullable = false)
    @ManyToOne(optional = false)
    private Persona iddigitador;
    @JoinColumn(name = "idpadronelectoral", referencedColumnName = "idpadronelectoral", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Padronelectoral padronelectoral;

    public Paginapadronelectoral() {
    }

    public Paginapadronelectoral(PaginapadronelectoralPK paginapadronelectoralPK) {
        this.paginapadronelectoralPK = paginapadronelectoralPK;
    }

    public Paginapadronelectoral(int numeropagina, String idpadronelectoral) {
        this.paginapadronelectoralPK = new PaginapadronelectoralPK(numeropagina, idpadronelectoral);
    }

    public PaginapadronelectoralPK getPaginapadronelectoralPK() {
        return paginapadronelectoralPK;
    }

    public void setPaginapadronelectoralPK(PaginapadronelectoralPK paginapadronelectoralPK) {
        this.paginapadronelectoralPK = paginapadronelectoralPK;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<Padronelectorallinea> getPadronelectorallineaList() {
        return padronelectorallineaList;
    }

    public void setPadronelectorallineaList(List<Padronelectorallinea> padronelectorallineaList) {
        this.padronelectorallineaList = padronelectorallineaList;
    }

    public Persona getIddigitador() {
        return iddigitador;
    }

    public void setIddigitador(Persona iddigitador) {
        this.iddigitador = iddigitador;
    }

    public Padronelectoral getPadronelectoral() {
        return padronelectoral;
    }

    public void setPadronelectoral(Padronelectoral padronelectoral) {
        this.padronelectoral = padronelectoral;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paginapadronelectoralPK != null ? paginapadronelectoralPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Paginapadronelectoral)) {
            return false;
        }
        Paginapadronelectoral other = (Paginapadronelectoral) object;
        if ((this.paginapadronelectoralPK == null && other.paginapadronelectoralPK != null) || (this.paginapadronelectoralPK != null && !this.paginapadronelectoralPK.equals(other.paginapadronelectoralPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "verins.beans.Paginapadronelectoral[ paginapadronelectoralPK=" + paginapadronelectoralPK + " ]";
    }
    
}
